<template>
  <!--   TODO 添加一个"导出销售榜单的按钮" -->
  <div>
    <div class="nav">
      <router-link to="/manager/performance" custom v-slot="{isActive, navigate}">
        <el-button :type="isActive ? 'primary' : ''" @click="navigate">业绩视图</el-button>
      </router-link>
      <router-link to="/manager/orders" custom v-slot="{isActive, navigate}">
        <el-button :type="isActive ? 'primary' : ''" @click="navigate">订单管理</el-button>
      </router-link>
        <router-link to="/manager/categories" custom v-slot="{isActive, navigate}">
          <el-button :type="isActive ? 'primary' : ''" @click="navigate">类别管理</el-button>
        </router-link>
      <router-link to="/manager/books" custom v-slot="{isActive, navigate}">
        <el-button :type="isActive ? 'primary' : ''" @click="navigate">商品管理</el-button>
      </router-link>
    </div>
    <router-view style="margin-top: 20px" />
  </div>
</template>

<script>
export default {
  name: "ManageView",
  beforeMount() {
    if (!this.$store.state.admin) {
      this.$router.replace("/")  // 禁止非特权用户登录
    }
  }
}
</script>

<style scoped>
.nav {
  display: flex;
  justify-content: center;
  align-items: center;
}
</style>